<?php
/**
 * Created by PhpStorm.
 * User: cephei
 * Date: 12/9/15
 * Time: 5:10 PM
 */

namespace Plugins\Log;

class Plugin_Log{
    public function log($message,$destination){
        error_log($message,3,$destination);
    }
    public function levelLog($message,$level){
        $time = date('Y-m-d H:i:s',time());
        switch($level){
            default:
            case "info":
                $this->log("[$time]:$message\n",ROOT_PATH."/Storage/Logs/info.log");
                break;
            case "warning":
                $this->log("[$time]:$message\n",ROOT_PATH."/Storage/Logs/warning.log");
                break;
            case "error":
                $this->log("[$time]:$message\n",ROOT_PATH."/Storage/Logs/error.log");
                break;
        }
    }
    public function dailyLog($message){
        $time = date('Y-m-d H:i:s',time());
        $fileTime = date('Y-m-d',time());
        $this->log("[$time]:$message\n",ROOT_PATH."/Storage/Logs/daily_$fileTime.log");
    }
}